<!--
 * @Author: lijing
 * @e-mail: 1413979079@qq.com
 * @LastEditors: lijing
 * @Date: 2019-10-26 17:20:07
 * @LastEditTime: 2020-04-21 23:56:52
 * @FilePath: \blog-pages\src\views\admin\index.vue
 * @Description: 管理系统主界面
 -->
<template>
  <div class="comm-con">
    <nav-bar></nav-bar>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
  </div>
</template>

<script>
import NavBar from "@/components/admin/NavBar";
import { mapState } from "vuex";
export default {
  name: "admin",
  components: {
    NavBar
  },
  computed: {
    ...mapState({
      isLogin: state => state.app.adminIsLogin
    })
  },
  created() {
    // 如果未登录的话，或者刷新页面的话，就直接跳转到主界面
    this.adminIsLogin || this.$router.replace("/admin/login");
  }
};
</script>

<style scoped>
</style>